﻿(function(){
	Mui.use('Mui.form.base,Mui.form.combo',function(){
		var d=$('<form id="form"></form>').appendTo(document.body);
		var html=[
			'<div>用户名：<input type="text" name="username"/></div>',
			'<div>密码：<input type="password" name="password"/></div>',
			'<div id="love">喜好：</div>',
			'<div id="love">性别：<input type="radio" name="sex" value="man"/>man<input type="radio" name="sex" value="woman"/>woman</div>',
			'<div id="love">爱好：<input type="checkbox" name="aa" value="aa"/>aa',
			'<input type="checkbox" name="aa" value="bb"/>bb',
			'<input type="checkbox" name="aa" value="cc"/>cc',
			'<input type="checkbox" name="aa" value="dd"/>dd',
			'</div>',
			'<div><input type="submit" value="提交"/></div>'
		];
		d.append(html.join(''));
		var combo=new Mui.form.combo({
			renderTo:'love',
			items:[{
				value:'1',
				data:'a',
				text:'足球'
			},{
				value:'2',
				data:'b',
				text:'篮球'
			},{
				value:'3',
				data:'c',
				text:'排球'
			},{
				value:'4',
				data:'d',
				text:'羽毛球'
			}],
			textName:'lovename',
			valueName:'loveid',
			hiddenField:'data'
		});
		var form=new Mui.form.base({
			id:'form',
			validate:[{
				name:'username',
				rules:{
					required:true,
					minlength:3,
					maxlength:10
				},
				message:{
					required:'请输入用户名',
					minlength:'长度必须超过3位',
					maxlength:'长度必须小于10位'
				},
				status:{
					success:'输入成功！',
					focus:'请输入6-10为的用户名',
					minlength:3,
					maxlength:10
				}
			},{
				name:'password',
				rules:{
					required:true
				},
				message:{
					required:'请输入密码！'
				},
				status:{
					success:'输入成功！',
					focus:'请输入6-10为的密码'
				}
			},{
				name:'lovename',
				rules:{
					required:true
				},
				message:{
					required:'请选择喜好'
				},
				status:{
					success:'输入成功！'
				}
			}]
		});
	});
})();